<!--
 * @Author: wwssaabb
 * @Date: 2021-05-26 08:19:22
 * @LastEditTime: 2021-05-26 09:31:45
 * @FilePath: \demo\canvas_demo\demo_API\arc.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>canvas_demo line</title>
  <style>
    *{
      margin: 0;
      padding:0;
    }
    body{
      width: 100vw;
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  </style>
</head>
<body>
  <canvas id="canvas1" width="800px" height="600px"></canvas>

  <script type="text/javascript">
    let canvas=document.querySelector('#canvas1')
    let ctx=canvas.getContext('2d')
    
    for(let i=29;i>0;i--){
      ctx.beginPath()
      ctx.arc(400,300,10+i*10,0,2*Math.PI)
      if(i%2===0){
        ctx.fillStyle='#000'
        ctx.fill()
      }else{
        ctx.fillStyle='#fff'
        ctx.fill()
      }
      ctx.stroke()
    }

    ctx.beginPath()
    ctx.arc(50,50,50,0,Math.PI/3)
    ctx.lineTo(50,50)
    ctx.lineTo(100,50)
    ctx.fillStyle='cyan'
    ctx.fill()
    ctx.stroke()

    ctx.beginPath()
    ctx.arc(50,500,50,0,Math.PI/180*120)
    ctx.lineTo(50,500)
    ctx.lineTo(100,500)
    ctx.fillStyle='cyan'
    ctx.fill()
    ctx.stroke()

    /* ctx.arc(400,300,100,0,2*Math.PI)
    ctx.closePath()
    ctx.arc(400,300,110,0,2*Math.PI)
    ctx.arc(400,300,120,0,2*Math.PI) */

    ctx.stroke()

  </script>

</body>
</html>